// pages/school/aboutus.js
var app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    width: '100%',
    height: '',
    version: '',
    QGroupModal: false,
    weappCodeImage: '../../../images/qrcode.png',
    coder: [{
      avatar: 'https://upload-images.jianshu.io/upload_images/4697920-1d2ea2adbeb9f1a0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240',
      nickName: '大笨笨一号'
    }],
    otherApps: [{
      appid: 'wxb7c9e6814c98ac52',
      icon: 'http://106.14.66.250:9000/dabenben/gh1.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20210505%2F%2Fs3%2Faws4_request&X-Amz-Date=20210505T133041Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=68b94b06b47182cbef0fc8c4d8386e147c9abd836c4c558c5571123a45210e3f',
      name: '询价小工具'
    }, {
      appid: 'wx53c26b21015772cc',
      icon: 'http://106.14.66.250:9000/dabenben/gh2.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20210505%2F%2Fs3%2Faws4_request&X-Amz-Date=20210505T133118Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=eb0271b85efdf554787130086cc50c0e99e5ad1073dbf3d316e395ba1bc3c1a4',
      name: '婚礼邀请函'
    }]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    const accountInfo = wx.getAccountInfoSync();

    that.setData({
      version: accountInfo.miniProgram.version,
      width: wx.getSystemInfoSync().windowWidth * 0.9 + 'px',
      height: wx.getSystemInfoSync().windowWidth * 0.9 * 0.5625 + 'px'
    })
    wx.pageScrollTo({
      scrollTop: 1600,
      duration: 4000,
    })

    wx.showShareMenu({
      withShareTicket: true,
      menus: ['shareAppMessage', 'shareTimeline']
    })

    setTimeout(function () {
      wx.pageScrollTo({
        scrollTop: 0,
        duration: 300,
      })
    }, 4000);
  },
  copyID: function () {
    wx.setClipboardData({
      data: 'wxf0ba93e3faff4eda'
    })
    wx.showToast({
      title: '已复制到粘贴版',
      icon: 'none',
      duration: 1000
    });
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function (res) {
    return {
      title: '关于 - 【贝壳小盒子】 ',
      path: 'pages/school/aboutus',
    }
  },
  showAppCode: function () {
    var weappCode = this.data.weappCodeImage;
    wx.previewImage({
      current: weappCode, // 当前显示图片的http链接
      urls: [weappCode] // 需要预览的图片http链接列表
    })
  },
  goOtherApps: function (e) {
    var appid = e.currentTarget.dataset.appid;
    wx.navigateToMiniProgram({ appId: appid })
  },
  checkUpdate: function () {
    wx.navigateTo({
      url: '../exam/index',
    })
  },
  showQQGroupCode: function () {
    this.setData({ QGroupModal: true })
  },
  hideQQGroupCode: function () {
    this.setData({ QGroupModal: false })
  },
  goWeibo: function (e) {
    var weiboPath = e.currentTarget.dataset.weibo;

    if (weiboPath.length > 0) {
      wx.navigateToMiniProgram({
        appId: 'wx9074de28009e1111',
        path: weiboPath
      })
    }
  }
})